package net.huashitong.supervision.task.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.supervision.task.dao.SMSLogDao;
import net.huashitong.supervision.task.entity.SMSLogEntity;
import net.huashitong.supervision.task.filter.SMSLogFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/11/29
 * Time: 10:18
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class SMSLogService extends StringPKService<SMSLogEntity> {
    @Autowired
    private SMSLogDao smsLogDao;
    @Autowired
    private SysTableService tableService;
    @Override
    protected BaseDao<SMSLogEntity, String> getDao() {
        return smsLogDao;
    }

    @Override
    protected void beforeSave(SMSLogEntity obj) {
        obj.setSysId(tableService.updateMaxSysId("t_sms_log", null));
    }

    public List<SMSLogEntity> queryBeforeDate(String pastDate) {

        return smsLogDao.queryBeforeDate(pastDate);
    }

    public  List<SMSLogEntity> getSmsLog(SMSLogFilter filter){
        return smsLogDao.queryLists(filter);
    }

}
